<?php

namespace App\Http\Middleware;

use Closure;

class CanAdminLogin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     */
    public function handle($request, Closure $next)
    {
        $admin = \Auth::user();

        if($admin->can('login')){

            return $next($request);

        }

        \Auth::logout();

        abort(403, '你没有权限访问登录');
    }
}
